package com.medicine.service.impl;

import java.util.HashMap;
import java.util.List;

import javax.persistence.criteria.CriteriaBuilder.In;

import org.springframework.stereotype.Service;

import com.medicine.dao.impl.SbkcxxDao;

import pagination.Page;
import po.Equipment;
import po.Ypkcxx;
import po.Ypxx;
import requestvo.EquipmentReqVo;
import requestvo.LabReqVo;

@Service
public class SbkcxxService extends BaseServiceImpl{

	public Page findSbkcxx(EquipmentReqVo sbkcxxReqVo){
		Page<EquipmentReqVo> page=new Page<>();
		if(sbkcxxReqVo.getSb_no()!=null&&!sbkcxxReqVo.getSb_no().equals("")){
			page.getParams().put("sb_no",sbkcxxReqVo.getSb_no());
		}
		if(sbkcxxReqVo.getSb_name()!=null&&!sbkcxxReqVo.getSb_name().equals("")){
			page.getParams().put("sb_name", "%"+sbkcxxReqVo.getSb_name()+"%");
		}
		if(sbkcxxReqVo.getSb_count()!=null&&!sbkcxxReqVo.getSb_count().equals("")){
			page.getParams().put("sb_count", sbkcxxReqVo.getSb_count());
		}
		if(sbkcxxReqVo.getSb_type()!=null&&!sbkcxxReqVo.getSb_type().equals("")){
			page.getParams().put("sb_type", sbkcxxReqVo.getSb_type());
		}
		if(sbkcxxReqVo.getSb_volume()!=null&&!sbkcxxReqVo.getSb_volume().equals("")){
			page.getParams().put("sb_volume", sbkcxxReqVo.getSb_volume());
		}
		if(sbkcxxReqVo.getDes()!=null&&!sbkcxxReqVo.getDes().equals("")){
			page.getParams().put("des", sbkcxxReqVo.getDes());
		}
		page.setPageNo(sbkcxxReqVo.getPage());
		page.setPageSize(sbkcxxReqVo.getRows());
		page.setResults(sbkcxxDao.findPage(page));
		return page;
	}
	public void updatesbkcxx(EquipmentReqVo sbkcxxReqVo){
		sbkcxxDao.update(sbkcxxReqVo);
	}
	public void addsbkcxx(EquipmentReqVo sbkcxxReqVo) {
		// TODO Auto-generated method stub
		sbkcxxDao.insert(sbkcxxReqVo);
		
	}
	public void delsbkcxx(String[] integers) {
		// TODO Auto-generated method stub
		sbkcxxDao.delete(integers);
		
	}
	public EquipmentReqVo getEquipmentName(String sb_name){
		return sbkcxxDao.getName(sb_name);
	}
	public EquipmentReqVo getEquipmentNo(String sb_no){
		return sbkcxxDao.get(sb_no);
	}
/*	public List<Ypkcxx> findAll(){
		return ypkcxxDao.find(new HashMap<>());
	}*/
	

}
